/**
  ******************************************************************************
  * @file    alarm_timing.c
  * @author  Sherlock
  * @version V0.1
  * @date    10/12/2023
  * @brief   Alarm timing handling.
  ******************************************************************************
  * @copy
  *
  * <h2><center>&copy; COPYRIGHT 2010 Feirui</center></h2>
  */ 



/**
  * @brief  INCLUDE FILES.
  */
#ifndef	ALARM_TIMING_GLOBALS
#define	ALARM_TIMING_GLOBALS
#include <includes.h>
#include "alarm_timing.h"


/*****************************************************************************************************************
 *                                                  低频告警
 *******************************************************************************************************************/
uint8_t Alarm_GenFreqInputAction(void)   //用于更新状态标志
{
    return DEF_TRUE;
}


uint8_t Alarm_GenFreqTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    return status;
}


/*****************************************************************************************************************
 *                                                  发电过压告警
 *******************************************************************************************************************/
uint8_t Alarm_GenVoltInputAction(void)
{
    if(GenVoltHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_GenVoltHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_GenVoltHigh);
    }

    return DEF_TRUE;
}


uint8_t Alarm_GenVoltTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = DEF_TRUE;
    float TempHighWarnTrip = TempNominalCfg->RatedPhaseVolt * TempAlarmCfg->OverVoltPhas_threshold / 100;   //被测机过压阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverVoltConfirm*AlarmInputTimingFreq;   //过压延时
    float TempRawDataL1 = GetMAXFrom3(ACAD_RTGlobalData.GenVoltData.GenPhaseVoltL1, ACAD_RTGlobalData.GenVoltData.GenPhaseVoltL2, ACAD_RTGlobalData.GenVoltData.GenPhaseVoltL3);
    
    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenVoltHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenVoltHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  负载过压告警
 *******************************************************************************************************************/
uint8_t Alarm_LoadVoltInputAction(void)
{
    if(LoadVoltHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_LoadVoltHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_LoadVoltHigh);
    }

    return DEF_TRUE;
}


uint8_t Alarm_LoadVoltTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = DEF_TRUE;
    float TempHighWarnTrip = TempNominalCfg->RatedPhaseVolt * TempAlarmCfg->OverVoltPhas_threshold / 100;   //负载机过压阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverVoltConfirm*AlarmInputTimingFreq;   //过压延时
    float TempRawDataL1 = GetMAXFrom3(ACAD_RTGlobalData.LoadVoltData.GenPhaseVoltL1, ACAD_RTGlobalData.LoadVoltData.GenPhaseVoltL2, ACAD_RTGlobalData.LoadVoltData.GenPhaseVoltL3);
    
    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &LoadVoltHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &LoadVoltHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  发电过流告警
 *******************************************************************************************************************/
uint8_t Alarm_GenCurrInputAction(void)
{
    if(GenCurrHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_GenCurrHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_GenCurrHigh);
    }

    return DEF_TRUE;
}


uint8_t Alarm_GenCurrTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = DEF_TRUE;
    float TempHighWarnTrip = TempNominalCfg->RatedCurrent * TempAlarmCfg->OverCurrent_precent / 100;   //发电过流阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverCurrentConfirm*AlarmInputTimingFreq;   //延时条件
    float TempRawDataL1 = GetMAXFrom3(ACAD_RTGlobalData.PowerData.GenCurrL1, ACAD_RTGlobalData.PowerData.GenCurrL2, ACAD_RTGlobalData.PowerData.GenCurrL3);
    
    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenCurrHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenCurrHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  发电励磁告警
 *******************************************************************************************************************/
uint8_t Alarm_GenExciteInputAction(void)
{
    if(GenExVoltHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_GenExVoltHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_GenExVoltHigh);
    }

    if(GenExCurrHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_GenExCurrHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_GenExCurrHigh);

    }
    return DEF_TRUE;
}


uint8_t Alarm_GenExciteTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = DEF_TRUE;
    float TempHighWarnTrip = TempNominalCfg->RatedExciVolt * TempAlarmCfg->OverExciVolt_precent / 100;   //励磁过压阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverExciVoltConfirm*AlarmInputTimingFreq;   //延时条件
    float TempRawDataL1 = ACAD_RTGlobalData.GenExcitationData.ExcitationVolt;
    
    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenExVoltHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenExVoltHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    TempHighWarnTrip = TempNominalCfg->RatedExciCurrent * TempAlarmCfg->OverExciCurrent_precent / 100;   //励磁过流阈值
    TempHighWarnTi = TempAlarmCfg->OverExciCurrentConfirm*AlarmInputTimingFreq;   //延时条件
    TempRawDataL1 = ACAD_RTGlobalData.GenExcitationData.ExcitationCurr;
    
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenExCurrHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenExCurrHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  负载励磁告警
 *******************************************************************************************************************/
uint8_t Alarm_LoadExciteInputAction(void)
{
    if(LoadExVoltHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_LoadExVoltHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_LoadExVoltHigh);

    }

    if(LoadExCurrHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_LoadExCurrHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_LoadExCurrHigh);

    }
    return DEF_TRUE;
}


uint8_t Alarm_LoadExciteTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = (testBenchWorkMode >= BenchWorkMode_Start) ? DEF_TRUE : DEF_FALSE;
    float TempHighWarnTrip = TempNominalCfg->RatedExciVolt * TempAlarmCfg->OverExciVolt_precent / 100;   //励磁过压阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverExciVoltConfirm*AlarmInputTimingFreq;   //延时条件
    float TempRawDataL1 = ACAD_RTGlobalData.LoadExcitationData.ExcitationVolt;
    
    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &LoadExVoltHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &LoadExVoltHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    TempHighWarnTrip = TempNominalCfg->RatedExciCurrent * TempAlarmCfg->OverExciCurrent_precent / 100;   //励磁过流阈值
    TempHighWarnTi = TempAlarmCfg->OverExciCurrentConfirm*AlarmInputTimingFreq;   //延时条件
    TempRawDataL1 = ACAD_RTGlobalData.LoadExcitationData.ExcitationCurr;
    
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &LoadExCurrHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &LoadExCurrHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  同步告警
 *******************************************************************************************************************/
uint8_t Alarm_SyncInputAction(void)
{
    if(SyncPhaseTiming.AlarmStatus || SyncVoltTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_SyncLoss;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_SyncLoss);
    }

    return DEF_TRUE;
}


uint8_t Alarm_SyncTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;

    uint8_t workModeStatus = (testBenchWorkMode == BenchWorkMode_PF) ? DEF_TRUE : DEF_FALSE;
    float TempHighWarnTrip = 2;   //同步相位相差2度即可看作失步
    uint16_t TempHighWarnTi = 5*AlarmInputTimingFreq/10;   //延时条件
    float TempRawDataL1 = ACAD_RTGlobalData.SyncData.PhaseDiffU1 > 0 ? ACAD_RTGlobalData.SyncData.PhaseDiffU1 : -ACAD_RTGlobalData.SyncData.PhaseDiffU1;
    float TempRawDataL2 = ACAD_RTGlobalData.SyncData.PhaseDiffU2 > 0 ? ACAD_RTGlobalData.SyncData.PhaseDiffU2 : -ACAD_RTGlobalData.SyncData.PhaseDiffU2;
    float TempRawDataL3 = ACAD_RTGlobalData.SyncData.PhaseDiffU3 > 0 ? ACAD_RTGlobalData.SyncData.PhaseDiffU3 : -ACAD_RTGlobalData.SyncData.PhaseDiffU3;
    TempRawDataL1 = GetMAXFrom3(TempRawDataL1, TempRawDataL2, TempRawDataL3);

    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &SyncPhaseTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &SyncPhaseTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    TempHighWarnTrip = 2;   //同步电压相差2V即可看作失步
    TempRawDataL1 = ACAD_RTGlobalData.SyncData.VoltDiffU1 > 0 ? ACAD_RTGlobalData.SyncData.VoltDiffU1 : -ACAD_RTGlobalData.SyncData.VoltDiffU1;
    TempRawDataL2 = ACAD_RTGlobalData.SyncData.VoltDiffU2 > 0 ? ACAD_RTGlobalData.SyncData.VoltDiffU2 : -ACAD_RTGlobalData.SyncData.VoltDiffU2;
    TempRawDataL3 = ACAD_RTGlobalData.SyncData.VoltDiffU3 > 0 ? ACAD_RTGlobalData.SyncData.VoltDiffU3 : -ACAD_RTGlobalData.SyncData.VoltDiffU3;
    TempRawDataL1 = GetMAXFrom3(TempRawDataL1, TempRawDataL2, TempRawDataL3);

    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &SyncVoltTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &SyncVoltTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


/*****************************************************************************************************************
 *                                                  功率告警
 *******************************************************************************************************************/
uint8_t Alarm_PowerInputAction(void)
{
    if(GenAcPowerHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_AcPowerHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_AcPowerHigh);
    }

    if(GenRePowerHighTiming.AlarmStatus)
    {
        Alarm_RTGlobalData |= AlarmType_RePowerHigh;
    }
    else
    {
        Alarm_RTGlobalData &= (~AlarmType_RePowerHigh);
    }

    if(GenPFLowTiming.AlarmStatus)
    {
Alarm_RTGlobalData |= AlarmType_GenPFLow;
    }
else
    {
Alarm_RTGlobalData &= (~AlarmType_GenPFLow);
    }

    return DEF_TRUE;
}


uint8_t Alarm_PowerTimingHandle(NominalCfg_ST *TempNominalCfg, SeriousAlarmCfg_ST *TempAlarmCfg)
{
    uint8_t status = DEF_FALSE;
    uint8_t workModeStatus = (testBenchWorkMode == BenchWorkMode_PF) ? DEF_TRUE : DEF_FALSE;

    //额定功率参数
    float nominalApparentPower = 3 * TempNominalCfg->RatedPhaseVolt * TempNominalCfg->RatedCurrent;
    float nominalActivePower = nominalApparentPower * TempNominalCfg->RatedPowerFactor;
    float nominalReactivePower = nominalApparentPower * sqrtf(1 - TempNominalCfg->RatedPowerFactor * TempNominalCfg->RatedPowerFactor);

    //发电有功功率
    float TempHighWarnTrip =  nominalActivePower * TempAlarmCfg->Overload_precent / 100;   //发电过有功告警阈值
    uint16_t TempHighWarnTi = TempAlarmCfg->OverAactPowerConfirm*AlarmInputTimingFreq;   //延时条件
    float TempRawDataL1 = ACAD_RTGlobalData.PowerData.GenPowerPTotal;

    InputAlarmSmart_ParamDef AlarmSmartParam;
    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenAcPowerHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenAcPowerHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    //发电无功功率
    TempHighWarnTrip = nominalReactivePower * TempAlarmCfg->OverReacPower_precent / 100;   //发电过无功告警阈值
    TempHighWarnTi = TempAlarmCfg->OverReacPowerConfirm*AlarmInputTimingFreq;   //延时条件
    TempRawDataL1 = ACAD_RTGlobalData.PowerData.GenPowerQTotal;

    AlarmSmartParam.Option      = workModeStatus;
    AlarmSmartParam.OperaType   = AlarmOperaType_HighShut;
    AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    AlarmSmartParam.Trip        = TempHighWarnTrip;
    AlarmSmartParam.Return      = TempHighWarnTrip;
    AlarmSmartParam.Value       = TempRawDataL1;
    AlarmSmartParam.Status      = &GenRePowerHighTiming.AlarmStatus;
    AlarmSmartParam.Ticnt       = &GenRePowerHighTiming.AlarmCnt;
    AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    AlarmSmartParam.Actcnt      = NULL;
    status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    //发电功率因数
    // TempHighWarnTrip = TempAlarmCfg->LowPowerFact_threshold;   //发电过无功告警阈值
    // TempHighWarnTi = TempAlarmCfg->PowerFactorConfirm*AlarmInputTimingFreq;   //延时条件
    // TempRawDataL1 = ACAD_RTGlobalData.PowerData.GenPFAverage;

    // AlarmSmartParam.Option      = workModeStatus;
    // AlarmSmartParam.OperaType   = AlarmOperaType_LowShut;
    // AlarmSmartParam.OffType     = AlarmOperaType_DisableInActive;
    // AlarmSmartParam.Trip        = TempHighWarnTrip;
    // AlarmSmartParam.Return      = TempHighWarnTrip;
    // AlarmSmartParam.Value       = TempRawDataL1;
    // AlarmSmartParam.Status      = &GenPFLowTiming.AlarmStatus;
    // AlarmSmartParam.Ticnt       = &GenPFLowTiming.AlarmCnt;
    // AlarmSmartParam.HighTiLimit = TempHighWarnTi;
    // AlarmSmartParam.LowTiLimit  = TempHighWarnTi;
    // AlarmSmartParam.Actcnt      = NULL;
    // status |= InputsAlarmSmartHandling(&AlarmSmartParam);

    return status;
}


void Alarm_InitTimingAlarmStatus(AlarmTimingUnitTypeDef *AlarmTiming)
{
    AlarmTiming->AlarmStatus = DEF_FALSE;
    AlarmTiming->AlarmCnt = 0;
}



#endif

/******************* (C) COPYRIGHT 2010 Feirui *****END OF FILE****/